package com.qf.service.impl;

import com.qf.entity.TClientBusiness;
import com.qf.events.TClientBusinessEvent;
import com.qf.mapper.ClientBusinessMapper;
import com.qf.service.TClientBusinessService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/*
杨威
2021/11/6
15:06
*/
@Service
@Transactional
public class TClientBusinessServiceImpl implements TClientBusinessService {
    @Autowired
    ClientBusinessMapper clientBusinessMapper;
    @Autowired
    ApplicationContext context;
    @Override
    public int add(TClientBusiness tClientBusiness) {
        int i = clientBusinessMapper.insertTClientBusiness(tClientBusiness);
        context.publishEvent(TClientBusinessEvent.class);
        return i;
    }

    @Override
    public int remove(Long id) {
        int i = clientBusinessMapper.deleteTClientBusiness(id);
        context.publishEvent(TClientBusinessEvent.class);
        return i;
    }

    @Override
    public int modify(TClientBusiness tClientBusiness) {
        int i = clientBusinessMapper.updateTClientBusiness(tClientBusiness);
        context.publishEvent(TClientBusinessEvent.class);
        return i;
    }
}
